package com.brother.util;

import java.util.ArrayList;

import com.ibatis.common.util.PaginatedList;

public class MyPaginatedList extends ArrayList implements PaginatedList {

	private int totalSize;
	private int totalPage;  // 从1开始
	private int pageSize;
	private int pageIndex; // 从0开始
	
	
	
	/**
	 * @param totalSize
	 * @param totalPage
	 * @param pageSize
	 * @param pageIndex
	 */
	public MyPaginatedList(int totalSize, int totalPage, int pageSize,int pageIndex) {
		super();
		this.totalSize = totalSize;
		this.totalPage = totalPage;
		this.pageSize = pageSize;
		this.pageIndex = pageIndex;
	}

	public int getTotalSize() {
		return totalSize;
	}

	public void setTotalSize(int totalSize) {
		this.totalSize = totalSize;
	}

	@Override
	public int getPageIndex() {
		return pageIndex;
	}

	@Override
	public int getPageSize() {
		return pageSize;
	}

	@Override
	public void gotoPage(int page) {
		pageIndex = page;
	}

	@Override
	public boolean isFirstPage() {
		return pageIndex == 0;
	}

	@Override
	public boolean isLastPage() {
		return (pageIndex + 1) == totalPage;
	}

	@Override
	public boolean isMiddlePage() {
		return false;
	}

	@Override
	public boolean isNextPageAvailable() {
		return false;
	}

	@Override
	public boolean isPreviousPageAvailable() {
		return false;
	}

	@Override
	public boolean nextPage() {
		return false;
	}

	@Override
	public boolean previousPage() {
		return false;
	}

	
}
